<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<load href='__PUBLIC__/lib/html5.js' />
<load href='__PUBLIC__/lib/respond.min.js' />
<load href='__PUBLIC__/lib/PIE_IE678.js' />

<load href='__PUBLIC__/css/H-ui.min.css' />
<load href='__PUBLIC__/css/H-ui.admin.css' />        
<load href='__PUBLIC__/lib/Hui-iconfont/1.0.1/iconfont.css' />
<title>订单管理</title>
</head>
<body>
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 订单中心 <span class="c-gray en">&gt;</span> 订单管理 <a class="btn btn-success radius r mr-20" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a></nav>

<div class="pd-20">
	<div class="text-c"> 
		<form class="form-search fr" action="{:U('index')}" method="get">
		<input type="text" class="input-text" style="width:250px" value="{$Think.get.name}" placeholder="输入会员名称" name="name">
		<button type="submit" class="btn btn-success radius" id="" name=""><i class="Hui-iconfont">&#xe665;</i> 搜索</button>
		</form>
	</div><br/>
		<div>
			<span >共有数据：<strong>{$total}</strong> 条</span>
		</div>
	<div class="mt-20">

	<table class="table table-border table-bordered table-hover table-bg table-sort">

		<thead>
			<tr class="text-c">

				<th width=""><input type="checkbox" name="" value=""></th>
				<th width="">订单编号</th>
				<th width="">会员编号</th>
				<th width="">联系人</th>
				<th width="">地址</th>
				<th width="">邮编</th>
				<th width="">电话</th>
				<th width="">购买时间</th>
				<th width="">总金额</th>
				<th width="">订单状态</th>
				<th width="">订单操作</th>			
			</tr>
		</thead>

		<tbody>
			<foreach name='list' item='val'>
			<tr class="text-c">
				<td><input type="checkbox" value="1" name=""></td>
				<td>{$val.id}</td>
				<td>{$val.u_id}</td>
				<td>{$val.linkman}</td>
				<td>{$val.address}</td>
				<td>{$val.code}</td>
				<td class="text-l">{$val.phone}</td>
				<td>{$val.addtime}</td>
				<td class="text-l">{$val.total}</td>
				<td class="td-status">{$val.status}</td>
				<!--<td><a href="{:U('detail?id='.$val['id'])}">订单详情</a></td>-->

				<if condition="$val['status'] eq '新订单'">
			      <td>
                  <a href="{:U('fahuo?id='.$val['id'])}" onFocus="this.blur()" ><span class="label label-danger radius">发货</span></a>

                  <a href="{:U('detail?id='.$val['id'])}" onFocus="this.blur()"><span class="label label-info radius">订单详情</span></a>

                  <a href="{:U('del?id='.$val['id'])}" onFocus="this.blur()"><span class="label label-danger radius" onclick="return confirm('确定删除吗？')">删除订单</span></a>
                   </td>            
               <elseif condition="$val['status'] eq '无效订单'"/>
              	<td >      
              	<a href='{:U('detail?id='.$val['id'])}' onFocus="this.blur()"><span class="label label-info radius">订单详情</span></a>
              	<a href="{:U('del?id='.$val['id'])}" onFocus="this.blur()"><span class="label label-danger radius" onclick="return confirm('确定删除吗？')"></span></a>
              	</td>  
               	<elseif condition="$val['status'] eq '已发货'"/>
                  	<td >
                  	<a onFocus="this.blur()"><span class="label label-primary radius">已发货</span></a>
                            
                  	<a href='{:U('detail?id='.$val['id'])}' onFocus="this.blur()"><span class="label label-info radius">订单详情</span></a>
                  	</td>
                   
                <else />
		 			<td>
                    <a onFocus="this.blur()"><span class="label label-primary radius">已发货</span></a>
                  
                    <a href='{:U('detail?id='.$val['id'])}' onFocus="this.blur()" ><span class="label label-info radius">订单详情</span></a>
                   
                    <a onFocus="this.blur()" ><span class="label label-success radius">已确认收货</span></a>
                    </td>
				</if>
			</tr>
			</foreach>
		</tbody>
	</table><br/>
		<div>
			{$pageButton}
		</div>
	</div>
</div>

<load href='__PUBLIC__/lib/jquery/1.9.1/jquery.min.js' />
<load href='__PUBLIC__/lib/layer/1.9.3/layer.js' />
<load href='__PUBLIC__/lib/laypage/1.2/laypage.js' />

<load href='__PUBLIC__/lib/My97DatePicker/WdatePicker.js' />
<load href='__PUBLIC__/lib/datatables/1.10.0/jquery.dataTables.min.js' />        
<load href='__PUBLIC__/js/H-ui.js' />
<load href='__PUBLIC__/js/H-ui.admin.js' />

<script type="text/javascript">

$(function(){
	// $('.table-sort').dataTable({
	// 	"aaSorting": [[ 1, "desc" ]],//默认第几个排序
	// 	"bStateSave": true,//状态保存
	// 	"aoColumnDefs": [
	// 	  //{"bVisible": false, "aTargets": [ 3 ]} //控制列的隐藏显示
	// 	  {"orderable":false,"aTargets":[0,8,9]}// 制定列不参与排序
	// 	]
	// });
	$('.table-sort tbody').on( 'click', 'tr', function () {
		if ( $(this).hasClass('selected') ) {
			$(this).removeClass('selected');
		}
		else {
			table.$('tr.selected').removeClass('selected');
			$(this).addClass('selected');
		}
	});
});
/*用户-添加*/
function member_add(title,url,w,h){
	layer_show(title,url,w,h);
}
/*用户-查看*/
function member_show(title,url,id,w,h){
	layer_show(title,url,w,h);
}
/*用户-停用*/
function member_stop(obj,id){
	layer.confirm('确认要停用吗？',function(index){
		$(obj).parents("tr").find(".td-manage").prepend('<a style="text-decoration:none" onClick="member_start(this,id)" href="javascript:;" title="启用"><i class="Hui-iconfont">&#xe6e1;</i></a>');
		$(obj).parents("tr").find(".td-status").html('<span class="label label-defaunt radius">已停用</span>');
		$(obj).remove();
		layer.msg('已停用!',{icon: 5,time:1000});
	});
}

/*用户-启用*/
function member_start(obj,id){
	layer.confirm('确认要启用吗？',function(index){
		$(obj).parents("tr").find(".td-manage").prepend('<a style="text-decoration:none" onClick="member_stop(this,id)" href="javascript:;" title="停用"><i class="Hui-iconfont">&#xe631;</i></a>');
		$(obj).parents("tr").find(".td-status").html('<span class="label label-success radius">已启用</span>');
		$(obj).remove();
		layer.msg('已启用!',{icon: 6,time:1000});
	});
}
/*用户-编辑*/
function member_edit(title,url,id,w,h){
	layer_show(title,url,w,h);
}
/*密码-修改*/
function change_password(title,url,id,w,h){
	layer_show(title,url,w,h);	
}
/*用户-删除*/
function member_del(obj,id){
	layer.confirm('确认要删除吗？',function(index){
		$(obj).parents("tr").remove();
		layer.msg('已删除!',{icon:1,time:1000});
	});
}
</script> 
</body>
</html>
